<?php 
session_start();
date_default_timezone_set("PRC"); 
$db = include('../Application/Common/Conf/config.php');  
$v_mid =  $db['bankid'];	
$key   =  $db['bankmd5'];
$baseUrl = $db['SITE_BASE_PATH'];
$v_url = 'http://'.$_SERVER['HTTP_HOST'].$baseUrl.'index.php/User/Recharge/checkorder';

$remark2 = '[url:=http://'.$_SERVER['HTTP_HOST'].$baseUrl.'recharge/AutoReceive.php]';
if(trim($_POST['v_oid'])<>"")					//判断是否有传递订单号
{
	$v_oid = trim($_POST['v_oid']); 
}
else
{
	$v_oid = date('Ymd',time()).$v_mid.date('His',time());//订单号，建议构成格式 年月日-商户号-小时分钟秒
}
	 
$v_amount = trim($_POST['choose']);  //支付金额  
//$v_amount=0.01;                             
$v_moneytype = "CNY";                                            //币种
$text = $v_amount.$v_moneytype.$v_oid.$v_mid.$v_url.$key;        //md5加密拼凑串,注意顺序不能变
$v_md5info = strtoupper(md5($text)); 
if($_POST){
$id = trim($_POST['account']);  //客户ID
$cname = trim($_POST['username']);   //客户昵称
$jinbi = trim($_POST['hjinbi']);     //充值金币

$_SESSION['orderid'] = $v_oid;
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" />
<link href="css/style.css" type="text/css" rel="stylesheet">
<link  id="iepng" href="" type="text/css" rel="stylesheet">
<script>
   if(window.XMLHttpRequest)
    {
        document.getElementById('iepng').href="css/normal.css";
    }
	
	window.onload = function(){
		if(document.all && navigator.appVersion.indexOf("MSIE")>-1 && navigator.appVersion.indexOf("Windows")>-1)
		{
			var a = document.getElementsByTagName("label");
			for(var i=0,j=a.length;i<j;i++){
				if(a[i].hasChildNodes && a[i].childNodes.item(0).tagName == "IMG")
				{
					a[i].childNodes.item(0).forid = a[i].htmlFor;
					a[i].childNodes.item(0).onclick = function(){
						
						var e = document.getElementById(this.forid);
						if(e.type=="radio"){
							e.checked|=1;
						}
					}
				}
			}
		}
	}



</script>
<script type="text/javascript" src="../Public/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" >
$(function(){

		$('.surebtn').click(function(){
			id  = "<?php echo $id?>";
			v_oid = '<?php echo $v_oid ;?>';
			v_amount = <?php echo $v_amount ;?>;
			jinbi  = '<?php echo $jinbi ;?>';
			
			if($("input[name='pmode_id']").val()!=''){
						   
			$.ajax({
			 type: "POST",
			 url: "create.php",
			 data: {id:id,v_oid:v_oid,v_amount:v_amount,jinbi:jinbi},
			 dataType: "text",
			 success: function(data){				
						if(data>0){
							$('.opacity,.mark').show();
							$('#E_FORM').submit();
						}else{
							alert('创建订单失败，请联系客服');
						}							
						}									
			})		   
	
			
			}else{
				alert('请选择支付银行');
			};

		});

	
})


</script>
<script type="text/javascript">
	$(function(){
		
			
		$("input[name='typebank']").css({"position":"relative","top":"-15px"});
		$('.bankItem').click(function(){
					
			$('.bankMethod').hide();
			$(this).next('.bankMethod').show();
			obj = $(this).next('.bankMethod').find("div:first").children('input');
			obj.attr('checked','true');
			$("input[name='pmode_id']").val(obj.val());
		})
		$("input[name='bank']").click(function(){
			id = $(this).val();
			$("input[name='pmode_id']").val(id);
			
		})	
		$(document).keypress(function(e) { 
          // 回车键事件 
		   if(e.which == 13) { 
				$('.surebtn').trigger("click");
		   } 
         });
	})
</script>
</head>
<body>
<div class="charge_wrap">
	<?php include 'left.php';?>

	<div class="chargeMain">
		<div class="chargeTitle"><span>网银充值金币</span></div>
		<div class="step"><img src="../Public/img/step2.jpg" /></div>
			<ul class="chareform sure">
				<li><label>充值帐号：</label><span><?php echo $id;?></span></li>
				<li><label>用户昵称：</label><span><?php echo $cname;?></span></li>
				<li><label>购买虚拟币数量：</label><span><font color="red"><?php echo number_format($jinbi);?></font>金币</span></li>
				<li><label>支付金额：</label><span id="money"><?php echo $v_amount;?>.0</span>元</li>
				
			</ul>
			<div class="banks">
				<div class="banks-title"><span>网上银行支付</span></div>
				<ul>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="gsyh"/>
							<label for="gsyh"><img src="img/gsyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" value="1025" id="gs-jj"><label for="gs-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" value="1027" id="gs-xy"><label for="gs-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="zsyh" />
							<label for="zsyh"><img src="img/zsyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="zs-jj" value="3080"><label for="zs-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="zs-xy" value="308"><label for="zs-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="jsyh"/>
							<label for="jsyh"><img src="img/jsyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="js-jj" value="1051"><label for="js-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="js-xy" value="1054"><label for="js-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>	
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="nyyh"/>
							<label for="nyyh"><img src="img/nyyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="ny-jj" value="103"><label for="ny-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="ny-xy" value="1031"><label for="ny-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
				</ul>
				<ul>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="jtyh"/>
							<label for="jtyh"><img src="img/jtyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" value="301" id="jt-jj"><label for="jt-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" value="301" id="jt-xy"><label for="jt-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="hxyh" />
							<label for="hxyh"><img src="img/hxyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="hx-jj" value="311"><label for="hx-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="hx-xy" value="3112"><label for="hx-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="hzyh"/>
							<label for="hzyh"><img src="img/hzyh.jpg" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="hz-jj" value="324"><label for="hz-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="hz-xy" value="3241"><label for="hz-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>	
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="xyyh"/>
							<label for="xyyh"><img src="img/xyyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="xy-jj" value="309"><label for="xy-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="xy-xy" value="3091"><label for="xy-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
				</ul>
				<ul>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="zgyzcxyh"/>
							<label for="zgyzcxyh"><img src="img/zgyzcxyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="zgyzcxyh-jj" value="3230"><label for="zgyzcxyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="zgyzcxyh-xy" value="3231"><label for="zgyzcxyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>	
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="gfyh"/>
							<label for="gfyh"><img src="img/gfyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="gfyh-jj" value="3061"><label for="gfyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="gfyh-xy" value="306"><label for="gfyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="zxyh"/>
							<label for="zxyh"><img src="img/zxyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="zxyh-jj" value="313"><label for="gfyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="zxyh-xy" value="3131"><label for="gfyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>					
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="shpdfzyh"/>
							<label for="shpdfzyh"><img src="img/shpdfzyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="shpdfzyh-jj" value="314"><label for="shpdfzyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="shpdfzyh-xy" value="3141"><label for="shpdfzyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
				</ul>
				<ul>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="gdyh"/>
							<label for="gdyh"><img src="img/gdyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="gdyh-jj" value="312"><label for="gdyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="gdyh-xy" value="3121"><label for="gdyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>	
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="msyh"/>
							<label for="msyh"><img src="img/msyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="msyh-jj" value="305"><label for="msyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="msyh-xy" value="3051"><label for="msyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="bjyh"/>
							<label for="bjyh"><img src="img/bjyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="bjyh-jj" value="310"><label for="bjyh-jj"><span>借记卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="nbyh"/>
							<label for="nbyh"><img src="img/nbyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="nbyh-jj" value="302"><label for="nbyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="nbyh-xy" value="303"><label for="nbyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>					
				</ul>
				<ul>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="payh"/>
							<label for="payh"><img src="img/payh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="payh-jj" value="307"><label for="payh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="payh-xy" value="3071"><label for="payh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="shyh"/>
							<label for="shyh"><img src="img/shyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="shyh-jj" value="326"><label for="shyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="shyh-xy" value="3261"><label for="shyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="qdyh"/>
							<label for="qdyh"><img src="img/qdyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="qdyh-jj" value="3341"><label for="qdyh-jj"><span>借记卡支付</span></label></div>
							<div><input name="bank" type="radio" id="qdyh-xy" value="334"><label for="qdyh-xy"><span>信用卡支付</span></label></div>
						 </div>
					</li>
					<li>
						 <div class="bankItem">
							<input type="radio" name="typebank"  id="hfyh"/>
							<label for="hfyh"><img src="img/hfyh.gif" /></label>
						 </div>
						 <div class="bankMethod">
							<div><input name="bank" type="radio" id="hfyh-jj" value="344"><label for="hfyh-jj"><span>借记卡支付</span></label></div>
						 </div>
					</li>						
				</ul>
			</div>
			<div style="clear:both;"></div>
			<div class="surebtn" style="margin-bottom:50px;">确认订单</div>
<!--以下信息为标准的 HTML 格式 + PHP 语言 拼凑而成的 网银在线 支付接口标准演示页面 无需修改-->

		<form method="post" name="E_FORM" target="_blank" id="E_FORM" action="https://Pay3.chinabank.com.cn/PayGate?encoding=UTF-8">
			<input type="hidden" name="v_mid"         value="<?php echo $v_mid;?>">
			<input type="hidden" name="v_oid"         value="<?php echo $v_oid;?>">
			<input type="hidden" name="v_amount"      value="<?php echo $v_amount;?>">
			<input type="hidden" name="v_moneytype"   value="<?php echo $v_moneytype;?>">
			<input type="hidden" name="v_url"         value="<?php echo $v_url;?>">
			<input type="hidden" name="v_md5info"     value="<?php echo $v_md5info;?>">
		 
		 <!--以下几项项为网上支付完成后，随支付反馈信息一同传给信息接收页 -->	
			
			<input type="hidden" name="remark1"       value="<?php echo $remark1;?>">
			<input type="hidden" name="remark2"       value="<?php echo $remark2;?>">



		<!--以下几项只是用来记录客户信息，可以不用，不影响支付 -->
			<input type="hidden" name="v_rcvname"      value="<?php echo $v_rcvname;?>">
			<input type="hidden" name="v_rcvtel"       value="<?php echo $v_rcvtel;?>">
			<input type="hidden" name="v_rcvpost"      value="<?php echo $v_rcvpost;?>">
			<input type="hidden" name="v_rcvaddr"      value="<?php echo $v_rcvaddr;?>">
			<input type="hidden" name="v_rcvemail"     value="<?php echo $v_rcvemail;?>">
			<input type="hidden" name="v_rcvmobile"    value="<?php echo $v_rcvmobile;?>">

			<input type="hidden" name="v_ordername"    value="<?php echo $v_ordername;?>">
			<input type="hidden" name="v_ordertel"     value="<?php echo $v_ordertel;?>">
			<input type="hidden" name="v_orderpost"    value="<?php echo $v_orderpost;?>">
			<input type="hidden" name="v_orderaddr"    value="<?php echo $v_orderaddr;?>">
			<input type="hidden" name="v_ordermobile"  value="<?php echo $v_ordermobile;?>">
			<input type="hidden" name="v_orderemail"   value="<?php echo $v_orderemail;?>">
			<input type="hidden" name="pmode_id" />

		</form>
	</div>
	<div style="clear:both"></div>

	<div class="mark">
		<div class="mark-title">
			<span>付款提示</span>
		</div>
		<div class="mark-main">
			<div class='mark-body'>
				<p><span style="position:relative;top:3px;"><img src="../Public/img/tip.jpg" /></span>请在打开的<font color="red">网银</font>网页完成付款后选择</p>
				<p style="color:red">注：付款完成前请不要关闭付款窗口。</p>
				<div class="btn"><a class="first"  href="checkorder.php?userid=<?php echo $id;?>">查看订单状态</a><a  href="index.php?userid=<?php echo $id;?>">返回首页</a></div>
				
			</div>
		</div>
	</div>
	
	
</div>
<div style="width:100%;height:15px;background:#fff;"></div>
<div class="opacity"></div>
</body>
</html>
<?php }else{
	echo '非法操作！';
	header("Location: index.php");
}?>